Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use odfdo instead of lpod-python #48

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jgrassler
Copy link

@jgrassler jgrassler commented Jun 7, 2024

lpod-python is quite dated, no longer maintained and increasingly hard to get to run on modern systems because it's Python 2 only and Python 2 is no longer supported upstream as of 2020 and has been removed from some Linux Distributions already.

There are two candidates for succession, odfdo and lpod-python3. odfdo has been modified while lpod-python3 retains the old API. I opted for odfdo because it's on PyPI while lpod-python3 isn't.

In this series of commits, I modified odpdown to use odfdo and adjusted the tests accordingly. The tests pass on Python 3.9 and Python 3.10 (I did not test any others).

A bit of a caveat on requirements: the lxml require is a bit tight because it is the sort of lowest common denominator setuptools can handle. If one wanted to specify all lxml versions odfdo allows, one would have to pull in poetry to allow for a package specification with more fine grained dependencies. I forewent that for now.

odfdo (https://github.com/jdum/odfdo) is a Python 3 library
for handling ODF documents. It is based on lpod-python which
is no longer actively maintained and still requires Python 2
to run. Since Python 2 is no longer supported by upstream and
increasingly becoming unavailable on contemporary operating
systems, it makes sense to switch to a Python 3 library.
These changes are the result of a simple

  2to3-2.7 -w

run on Ubuntu 20.04 and have not been vetted for correctness,
yet. Any required fixes will follow in subsequent commits.
The following requirements needed adjusting:

* odfdo requires a minimum lxml version of 4.8.0 on python3.9
  so it does not make sense to require a lower version here.
* In a Python 3 environment one needs to use beautifulsoup4
* We need to ensure we get mistune < 2.0.0 because later
  versions introduced breaking API changes.
The odfdo API has been refactored to be more object oriented
so all code using lpod functions needed to be adapted to work
with odfdo classes.
With Python versions later than 3.9, nose tests will break due
to

  nose AttributeError: module 'collections' has no attribute 'Callable'

Switching to pynose which accounts for later Python versions
fixes the problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant